package realDeal;

import sun.security.util.BitArray;

public class FullSizeBucket {

	private BitArray[] counters;

	public FullSizeBucket(int stepLength) {
		counters = new BitArray[stepLength];
		for (int i = 0; i < stepLength; ++i) {
			counters[i] = new BitArray(Statics.MAX_WIDTH);
		}
	}

	public void incrementFull(int index) {
		Statics.incrementBitArray(counters[index]);// the static function
	}

	public int getFull(int index) {
		int sum = 0;
		int mult = 1;
		for (int i = Statics.MAX_WIDTH - 1; i >= 0; i--) {
			sum += counters[index].get(i) ? mult : 0;
			mult = mult << 1;
		}
		return sum;
	}

	public void setBitAt(int counterIndex, int bitIndex, boolean value) {
		counters[counterIndex].set(Statics.MAX_WIDTH - bitIndex , value);
	}
}
